<template>
  <div class="quality-recommend">
    <div class="slider-banner swiper">
      <swiper class="swiper-wrapper" :options="RecommendSwiper">
        <swiperSlide class="swiper-slide">
          <img src="@assets/imgs/bannerone.jpg" class="slide-image" />
        </swiperSlide>
        <swiperSlide class="swiper-slide">
          <img src="@assets/imgs/bannertwo.jpg" class="slide-image" />
        </swiperSlide>
      </swiper>
      <div class="swiper-pagination"></div>
    </div>
    <div class="title acea-row row-center-wrapper">
      <div class="line"></div>
      <div class="name">
        <span class="iconfont" :class="icon"></span>{{ name }}
      </div>
      <div class="line"></div>
    </div>
    <GoodList :good-list="goodsList" :is-sort="false"></GoodList>
  </div>
</template>
<script>
import { swiper, swiperSlide } from "vue-awesome-swiper";
import "@assets/css/swiper.min.css";
import GoodList from "@components/GoodList";
import { getGroomList } from "@api/store";
export default {
  name: "HotNewGoods",
  components: {
    swiper,
    swiperSlide,
    GoodList
  },
  props: {},
  data: function() {
    return {
      imgUrls: [],
      goodsList: [
        {
          id:"11",
          image:"http://activity.crmeb.net/public/uploads/attach/2019/05/30//0eecbfbca9ebc315c2882590fd55a209.jpg",
          store_name:"伊利酸奶畅轻整箱装乳酸菌燕麦黄桃草莓早餐奶250克9瓶风味发酵乳",
          price:"80.00",
          vip_price:"",
          sales:"73",
          unit_name:"件"
        },{
          id:"7",
          image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//6f2a1ece45e307f274e3384410a3bd3a.jpg",
          store_name:"【华为畅享9S】华为HUAWEI畅享9S6GB+64GB珊瑚红全网通2400万超广角三摄珍珠屏大存储移动联通电信4G手机双卡双待",
          price:"100.00",
          vip_price:"",
          sales:"25",
          unit_name:"件"
        },{
          id:"3",
          image:"http://datong.crmeb.net/public/uploads/attach/2019/01/15/5c3dc0ef27068.jpg",
          store_name:"智米加湿器 白色",
          price:"249.00",
          vip_price:"",
          sales:"118",
          unit_name:"件"
        },{
          id:"2",
          image:"http://datong.crmeb.net/public/uploads/attach/2019/01/15/5c3dbc27c69c7.jpg",
          store_name:"智能马桶盖 AI版",
          price:"0.01",
          vip_price:"",
          sales:"232",
          unit_name:"件"
        }
        // [{
        //   id:"11",
        //   image:"http://activity.crmeb.net/public/uploads/attach/2019/05/30//0eecbfbca9ebc315c2882590fd55a209.jpg",
        //   store_name:"伊利酸奶畅轻整箱装乳酸菌燕麦黄桃草莓早餐奶250克9瓶风味发酵乳",
        //   price:"80.00",
        //   vip_price:"",
        //   sales:"73",
        //   unit_name:"件"
        // },{
        //   id:"9",
        //   image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//51308e61ace45968fdef953b2ac6c241.jpg",
        //   store_name:"【雷神911Air星战】雷神(ThundeRobot)911Air星战二代旗舰版15.6英寸窄边框游戏笔记本电脑i79750H512GSSDRGB键盘GTX1650",
        //   price:"1000.00",
        //   vip_price:"",
        //   sales:"43",
        //   unit_name:"件"
        // },{
        //   id:"8",
        //   image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//71e85589cb7d3398d08f0d55bdb9031d.jpg",
        //   store_name:"【AppleiPhone8】AppleiPhone8(A1863)256GB深空灰色移动联通电信4G手机",
        //   price:"0.00",
        //   vip_price:"",
        //   sales:"20",
        //   unit_name:"件"
        // },{
        //   id:"7",
        //   image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//6f2a1ece45e307f274e3384410a3bd3a.jpg",
        //   store_name:"【华为畅享9S】华为HUAWEI畅享9S6GB+64GB珊瑚红全网通2400万超广角三摄珍珠屏大存储移动联通电信4G手机双卡双待",
        //   price:"100.00",
        //   vip_price:"",
        //   sales:"25",
        //   unit_name:"件"
        // }],[{
        //   id:"9",
        //   image:"http://activity.crmeb.net/public/uploads/attach/2019/05/29//51308e61ace45968fdef953b2ac6c241.jpg",
        //   store_name:"【雷神911Air星战】雷神(ThundeRobot)911Air星战二代旗舰版15.6英寸窄边框游戏笔记本电脑i79750H512GSSDRGB键盘GTX1650",
        //   price:"1000.00",
        //   vip_price:"",
        //   sales:"43",
        //   unit_name:"件"
        // },{
        //   id:"3",
        //   image:"http://datong.crmeb.net/public/uploads/attach/2019/01/15/5c3dc0ef27068.jpg",
        //   store_name:"智米加湿器 白色",
        //   price:"249.00",
        //   vip_price:"",
        //   sales:"118",
        //   unit_name:"件"
        // },{
        //   id:"2",
        //   image:"http://datong.crmeb.net/public/uploads/attach/2019/01/15/5c3dbc27c69c7.jpg",
        //   store_name:"智能马桶盖 AI版",
        //   price:"0.01",
        //   vip_price:"",
        //   sales:"232",
        //   unit_name:"件"
        // }]
      ],
      name: "",
      icon: "",
      RecommendSwiper: {
        pagination: {
          el: ".swiper-pagination",
          clickable: true
        },
        autoplay: {
          disableOnInteraction: false,
          delay: 2000
        },
        loop: true,
        speed: 1000,
        observer: true,
        observeParents: true
      }
    };
  },
  mounted: function() {
    this.titleInfo();
    this.getIndexGroomList();
  },
  methods: {
    titleInfo: function() {
      let type = this.$route.params.type;
      if (type === "1") {
        this.name = "精品推荐";
        this.icon = "icon-jingpintuijian";
        document.title = "精品推荐";
      } else if (type === "2") {
        this.name = "热门榜单";
        this.icon = "icon-remen";
        document.title = "热门榜单";
      } else if (type === "3") {
        this.name = "首发新品";
        this.icon = "icon-xinpin";
        document.title = "首发新品";
      }
    },
    getIndexGroomList: function() {
      let that = this;
      let type = this.$route.params.type;
      console.log(type);
      getGroomList(type)
        .then(res => {
          that.imgUrls = res.data.banner;
          that.goodsList = res.data.list;
          // console.log(res.data.list);
        })
        .catch(function(res) {
          this.$dialog.toast({ mes: res.msg });
        });
    }
  }
};
</script>
